$(document).ready(function() {
//	$('.load_header').load('./header.html');
//	$('.load_bottom').load('./bottom.html');
	
	petIndex.lunbo();
	petIndex.goods_tabs_select();
	petIndex.drop_down_menu_select();
})
var petIndex = {
	ajax: function() {
		$.ajax({
			url: url_index,
			async: true,
			data: postData,
			success: function() {

			}
		})
	},

	//首页菜单数据渲染 获取数据 渲染三个drop_down_right 
	render_drop_menu: function() {
		indexMenu
		var drop_down_right_string;
		var dd_str_brand_dog;
		var dd_str_brand_dog;
		var dd_str_brand_cat;
		var dd_str_brand_cat;
		var dd_str_brand_pet;
		var dd_str_brand_pet;

		$.each(indexMenu.dog.brand, function(index, value) {
			dd_str_brand_dog += '<dd>' + value + '</dd>';
		});
		$.each(indexMenu.dog.func, function(index, value) {
			dd_str_brand_dog += '<dd>' + value + '</dd>';
		});
		$.each(indexMenu.cat.brand, function(index, value) {
			dd_str_brand_cat += '<dd>' + value + '</dd>';
		});
		$.each(indexMenu.cat.func, function(index, value) {
			dd_str_brand_cat += '<dd>' + value + '</dd>';
		});
		$.each(indexMenu.pet.brand, function(index, value) {
			dd_str_brand_pet += '<dd>' + value + '</dd>';
		});
		$.each(indexMenu.pet.func, function(index, value) {
			dd_str_brand_pet += '<dd>' + value + '</dd>';
		});

	},

	//轮播图
	lunbo: function() {
		$("#container").PageSwitch({
			direction: 'horizontal',
			easing: 'ease-in',
			duration: 1000,
			autoPlay: true,
			loop: 'false'
		});
	},
	//商品tap按钮选择
	goods_tabs_select: function() {
		$('.goods_title_rg li').on('click', function() {
			$(this).addClass('active').siblings('li').removeClass('active');
		})
	},
	//	全部商品下拉菜单
	drop_down_menu_select: function() {
		//	hover事件绑定
		$(document).on('mouseover mouseout', '.drop_down_menu li', function(event) {
			if(event.type == 'mouseover') {
				$('.drop_down_menu').stop().animate({ height: '440px' }, 400);
				var belongto = $(this).attr('belongto');
				$(this).addClass('active').siblings('li').removeClass('active');
				$('.down_menu_right[belongto="' + belongto + '"]').stop().animate({ width: '700px' }, 50);
			} else {
				$('.drop_down_menu').stop().animate({ height: '0px' }, 1000);
				var belongto = $(this).attr('belongto');
				$(this).removeClass('active');
				$('.down_menu_right[belongto="' + belongto + '"]').stop().animate({ width: '0px' }, 50);
			}
		})

		$(document).on('mouseover mouseout', '.whole_goods_menu', function(event) {
			if(event.type == 'mouseover') {
				$('.drop_down_menu').stop().animate({ height: '440px' }, 400);

			} else {
				$('.drop_down_menu').stop().animate({ height: '0px' }, 400);

			}
		})

		// 下拉菜单的右边菜单
		$(document).on('mouseover mouseout', '.down_menu_right', function(event) {
			if(event.type == 'mouseover') {
				$('.drop_down_menu').stop().animate({ height: '440px' }, 400);

				var belongto = $(this).attr('belongto');
				$('.down_menu_right[belongto="' + belongto + '"]').stop().animate({ width: '700px' }, 50);

				$('.drop_down_menu li[belongto="' + belongto + '"]').addClass('active').siblings().removeClass('active');
			} else {
				$('.drop_down_menu').stop().animate({ height: '0px' }, 400);

				var belongto = $(this).attr('belongto');
				$('.down_menu_right[belongto="' + belongto + '"]').stop().animate({ width: '0px' }, 50);

				$('.drop_down_menu li[belongto="' + belongto + '"]').removeClass('active')
			}
		})
	}

}